from selenium.webdriver.common.by import By
from Base.Base import Base
from time import sleep
class Page2(Base):
    #侧边栏
    cebian_loc = (By.XPATH,'/html/body/div[1]/div/section/aside/ul/li/div')
    def cebian(self):
        self.click(self.cebian_loc)

    #登录页面
    login_loc = (By.XPATH,'/html/body/div[1]/div/section/aside/ul/li/ul/li[14]/a')
    def login(self):
        self.click(self.login_loc)

    #用户名
    users_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/div[1]/div/input')
    def user(self):
        self.send_keys(self.users_loc,'hzy')

    #密码
    pwdd_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/div[2]/div/input')
    def pwd(self):
        self.send_keys(self.pwdd_loc,'123')

    #点击登录
    loginbtn_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/button[2]/span')
    def loginbtn(self):
        self.click(self.loginbtn_loc)

    #确定
    queding_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[2]/div/div/div/div[2]/button[2]/span')
    def queding(self):
        self.click(self.queding_loc)

    #搜索
    sousuo_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/form/div/div[1]/div/div/div/div/input')
    def sousuo(self):
        self.send_keys(self.sousuo_loc,'森林')

    #点击搜索
    dianji_loc = (By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/form/div/div[4]/button/span')
    def dianji(self):
        self.click(self.dianji_loc)

    # def sousuo_luoji(self):
    #     self.open_url('http://localhost:8080/')
    #     sleep(2)
    #     # self.cebian()
    #     self.login()
    #     sleep(2)
    #     self.user()
    #     sleep(2)
    #     self.pwd()
    #     sleep(2)
    #     self.loginbtn()
    #     sleep(2)
    #     self.queding()
    #     sleep(2)
    #     self.sousuo()
    #     sleep(2)
    #     self.dianji()